﻿using System.Xml.Linq;
using Maple.Weixin.MP.Helpers;

namespace Maple.Weixin.MP.Entities.Messages
{
    public sealed class RequestMessageText : RequestMessageBase
    {
        internal RequestMessageText() {
            
        }

        internal RequestMessageText(string content) {
            this.Content = content;
        }

        public override RequestMessageType MsgType
        {
            get { return RequestMessageType.Text; }
        }

        protected override void FillPropertiesByXml(XDocument document) {
            base.FillPropertiesByXml(document);
            this.Content = document.GetElementValue("Content");
        }

        public override T Accept<T>(RequestMessageVisitor<T> visitor) {
            return visitor == null ? default(T) : visitor.Visit(this);
        }

        public string Content { get; private set; }
    }
}
